package com.mh.controller;

import com.mh.pojo.visualParam;
import com.mh.utils.AiUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * Date:2025/3/14
 * author:zmh
 * description: Ai相关接口
 **/

@RestController
@RequestMapping("/ai")
@CrossOrigin
@Slf4j
@RequiredArgsConstructor
public class AiController {

    // AI工具类
    private final AiUtils aiUtils;

    /**
     * 视觉处理
     * @param visualParam 请求参数：图片名称和问题内容
     * @return 处理结果
     * @throws Exception ·
     */
    @PostMapping("/visualProcess")
    public String visualProcess(@RequestBody visualParam visualParam) throws Exception {
        return aiUtils.visualProcess(visualParam.getPicName(), visualParam.getQuestion());
    }


    /**
     * 文本处理
     * @param visualParam 请求参数：问题内容
     * @return 处理结果
     * @throws Exception ·
     */
    @PostMapping("/textProcess")
    public String textProcess(@RequestBody visualParam visualParam) throws Exception {
        return aiUtils.textProcess(visualParam.getQuestion());
    }

}
